<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>动态组件</title>
		<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
		<style>
			* {
				margin: 0;
				padding: 0;
			}

			body {
				width: 100%;
				height: 100%;
			}

			footer {
				height: 30px;
				width: 100%;
				background-color: #cccccc;
				position: fixed;
				left: 0;
				bottom: 0;
			}

			footer ul {
				list-style: none;
				height: 100%;
				display: flex;
				justify-content: space-between;
			}

			footer ul li {
				text-align: center;
				width: 33%;
				line-height: 30px;
			}
		</style>
	</head>
	<body>
		<div id="app">
			<home v-show="isWhitch === 1"></home>
			<detail v-show="isWhitch === 2"></detail>
			<cart v-show="isWhitch === 3"></cart>
			<footer>
				<ul>
					<li @click="isWhitch=1">首页</li>
					<li @click="isWhitch=2">详情</li>
					<li @click="isWhitch=3">购物车</li>			
				</ul>
			</footer>
		</div>
		<script type="text/javascript">
			Vue.component("home",{
				template:`<div>home</div>`
			})
			Vue.component("detail",{
				template:`<div>datail</div>`
			})
			Vue.component("cart",{
				template:`<div>cart</div>`
			})
			
			let vm = new Vue({
				el:"#app",
				data:{
					isWhitch:1
				}
			})
		</script>
	</body>
</html>
